<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2017/11/14 014
 * Time: 14:02
 */
namespace App\Singleton;

class Singleton
{
    private static $_instance = null;

    private function __construct() {
    }

    private function __clone() {
    }

    static public function getInstance() {
        if (is_null ( self::$_instance ) || isset ( self::$_instance )) {
            self::$_instance = new self ();
        }
        return self::$_instance;
    }

    public function getName() {
        echo 'hello world!';
    }
}